﻿/*!	@file	r_debug_profile_client.h
	@brief	リアルタイムプロファイラ
Copyright (c) 2010 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _R_DEBUG_PROFILE_CLIENT_H_
#define _R_DEBUG_PROFILE_CLIENT_H_

#include "../r_type.h"

namespace r{
	namespace thread{
		namespace profile{
			//! 区分け用
			enum Type {
				Type_Default = 0,	//!< 一般
				Type_Draw,			//!< 描画処理
				Type_Dynamics,		//!< 物理演算処理
				Type_Rest,			//!< 完了待ち時間
				Type_Term
			};

			//! プロファイルクライアント
			/*!
			*/
			class Client
			{
			public:
				//! コンストラクタ
				/*!
				@param	name	プロファイルに使用する名前
				@param	type	処理バーを分類するための値 Type
				*/
				Client ( const r_cstr name, r_si8 type = Type_Default );
				//! デストラクタ
				~Client ( void );

				//! 名前データの取得
				inline const r_cstr	getName ( void ) const {
					return prfName;
				}
				//! 突入時間の取得
				inline r_time		getInTime ( void ) const {
					return prfInTime;
				}
				//! 終了時間の取得
				inline r_time		getOutTime ( void ) const {
					return prfOutTime;
				}
				//! 経過時間の取得
				inline r_time		getTime ( void ) const {
					return prfTime;
				}
				//! 種別データの取得
				inline r_si8		getType ( void ) const {
					return prfType;
				}
			protected:
			private:
				//! 時間計算用
				r_time			prfInTime;
				r_time			prfOutTime;
				r_time			prfTime;
				//! 識別用に...
				const r_cstr	prfName;
				r_si8			prfType;
			};
		}
	}
}


#endif // _R_DEBUG_PROFILE_CLIENT_H_
